1. Field of the Invention
The present invention relates to a method and apparatus for decoding a moving image, and more particularly, to a method and apparatus for motion compensation.
2. Description of the Related Art
A moving image decoding goes through several processes. Such processes largely include an entropy decoding, an inverse transform, inverse quantization, and motion compensation. Here, the motion compensation consumes the most processing time. According to the motion compensation, data about a part shared by a reference image and a current image is extracted from the reference image by referring to a motion vector, which shows a disparity between blocks of the current image and corresponding blocks of the reference image, and the current image is restored by adding the extracted data (hereinafter, referred to as motion compensation data) and data about a difference between the reference image and the current image (hereinafter, referred to as residue data). As described above, since the motion compensation should process massive amount of image data, a memory access amount and an operation amount are large. Since a throughput of the motion compensation is proportional to the size of an image, when the size of the image increases, the image may not be entirely processed within a required time, and thus a moving image may not be smoothly reproduced.
Most moving image codec engineers prefer realizing a moving image codec in software. This is because when a moving image codec is realized in software, a development period and expenses are reproduced and re-use of the moving image codec is easy compared to realizing the moving image in hardware. Specifically, flexibility of the moving image codec is high, and thus when an error occurs in the moving image codec, the software can easily correct the error. However, the core of the moving image codec is in a real-time process. Even if realizing the moving image codec in the software has various advantages, it is useless if the moving image codec cannot encode and decode an image in real-time. Meanwhile, when the moving image codec is realized in hardware, a development period and expenses increase, and flexibility is low. Accordingly, when the moving image codec needs to be amended, the entire structure of the moving image codec may be changed. However, when the moving image codec is realized in hardware, the moving image codec can be optimized to a target, and thus the speed of encoding and decoding a moving image can be rapidly increase compared to processing the moving image codec in software.
Due to different advantages and disadvantages of methods of realizing a moving image codec in hardware and software, most moving image codec engineers combine the two methods. That is, a module forming the moving image codec is divided into a part that is to be processed by software and a part that is to be processed by hardware according to characteristics of the parts. In this case, the motion compensation should be processed by hardware. In the motion compensation, not only massive data throughput is required, but also a memory access is far larger than other processes, and thus it is not suitable to process the motion compensation in software.
Recently, an important issue in realizing the moving image codec is to reproduce various moving image formats in one moving image player. Mostly used moving image formats include MPEG4, VC1, and H.264/AVC. However, when such three codecs are realized in one device and the motion compensation for each codec is realized, data throughput and memory access amount remarkably increase when the codecs are processed in software and the size of hardware and manufacture expenses increase when the codecs are processed in hardware.